//邀请页面
var app = getApp(); //全局APP

Page({
  //页面数据
  data: {
    code: '',
    money: 0,
    number: 0,
    is_superior: false,
    inviteKey: '',
    pop: false,
    painting: {},
    shareImage: '',
    appTitle: ''
  },


  //页面加载
  onLoad: function (options) {
    var that = this;
    wx.request({
      url: 'https://wukongweixiu.cn/index/Shere/getuserinfo',
      data: {
        id: getApp().globalData.id,
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      method: 'GET',
      success: function (res) {
        console.log(res);
       that.setData({
         number: res.data.total,
         money: res.data.ticheng,
         myInviteCode: res.data.member.id
       })
   
      },
      fail: function (res) { },
    });
wx.request({
      url: 'https://wukongweixiu.cn/index/Shere/getuserinfo',
      data: {
        id: getApp().globalData.id,
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      method: 'GET',
      success: function (res) {
        console.log(res);
       that.setData({
         number: res.data.total,
         money: res.data.ticheng,
         myInviteCode: res.data.member.id
       })
   
      },
      fail: function (res) { },
    });

 
  },
  //分享到微信群
  onShareAppMessage: function () { 
    let page = this;
    let myInviteCode = page.data.myInviteCode;
    if (myInviteCode) {
  
      let path = '/pages/default/default?invite=' + myInviteCode;
      return {
        title: '悟空维修',
        path: path,
        imageUrl: '/img/openproxy.jpg'
      }
    } else {
      // let path = '/pages/default/default?invite=7';
      return {
        title:'悟空维修',
        path: path,
        imageUrl: '/img/openproxy.jpg'
      }
    }
  }

})